import BaseModel from './BaseModel'
import { ImageFill, PixelUnitType, VideoFrame } from '../utils/filters'
import Config from '../config/index'

class OSSFileModel extends BaseModel {

  // 文件名称
  public name!: string
  // 文件URL
  public url = null
  // 是否播放
  public play = false

  // 构造方法
  constructor() {
    super()
  }

  /* ----- 获取指定图片大小 -------*/
  get cdnUrl() {
    return `${Config.imageCDNPerfix}${this.name}`
  }

  get photoUrl() {
    return `${Config.photoCDNPerfix}${this.name}`
  }

  get pcWebListUrl() {
    return ImageFill(this.cdnUrl, 200, 200)
  }

  get pcPhotoListUrl() {
    return ImageFill(this.photoUrl, 200, 200)
  }

  get mPhotoListUrl() {
    return ImageFill(this.photoUrl, 4, 4, PixelUnitType.rem)
  }

  // 视频截帧
  get pcVideoFromeUrl() {
    return VideoFrame(this.photoUrl, 0, 300, 0)
  }

  // 视频截帧
  get mVideoFromeUrl() {
    return VideoFrame(this.photoUrl, 0, 500, 0)
  }

}

export default OSSFileModel
